Fix container running as root in Dockerfile#1717
Conversation
Agent-Logs-Url: https://github.com/TransactionProcessing/TransactionProcessor/sessions/9d8c4a92-e07c-4d8f-aa76-c5ffc531a75c Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
Up to standards ✅🟢 Issues
|
|
@copilot here is what was done in one of my other repositories FROM base AS final |
Agent-Logs-Url: https://github.com/TransactionProcessing/TransactionProcessor/sessions/c9ea5c84-2336-42ff-b4d8-10fa3a30cbec Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
Updated in commit |
|
@copilot my docker container now doesnt start in my integration tests, can you have a look why this could be |
…llow startup Agent-Logs-Url: https://github.com/TransactionProcessing/TransactionProcessor/sessions/fac6abcc-24c7-486d-989e-e1a7033d129d Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
The container was crashing before Kestrel could start because Fixed in commit Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Without a
USERinstruction, the container process runs asroot, violating least-privilege principles and flagged as a high-severity security issue by Codacy.Changes
TransactionProcessor/Dockerfile: In the final stage, create a dedicated non-root user (appuser) with explicit UID/GID 10001, no login shell, and switch to it before the entrypoint. TheCOPYinstruction also sets ownership directly via--chown=appuser:appuser.